{% import "TopxiaWebBundle::macro.html.twig" as web_macro %}

{# 直播 #}
<div class="es-box es-course">                
    <h2>{{ config.title|default(config.defaultTitle) }}</h2>
    {% set count = config.count %}
    {% set courses = data('RecentLiveCourses',{'count':count}) %}
    {% if courses %}
      <ul class="row">
      {% for zhibo in courses %}
            {% if zhibo %}
               <li class="col-sm-6 col-md-4 es-course-list">
                    <div>
                          <div class="course-top">
                                 <img src="{{ file_path(zhibo.largePicture, 'course-large.png') }}" class="img-responsive thumb">
                                  <span>直播:  {{ zhibo.lesson.startTime|date('n月j日 H:i') }}
                                  </span>
                          </div>

                          <div class="course-bottom">
                                <h3>{{ zhibo.lesson.title }}</h3>
                                <p class="metas clearfix">
                                 
                                      {% if zhibo.price > 0 %}
                                        <span class="price-num">¥{{ zhibo.price }}</span>
                                      {% else %}
                                        <span class="price-num">免费</span>
                                      {% endif %}
                                      <span class="student-num">{{ zhibo.studentNum }}人报名</span>
                                </p>

                                <span class="nickname">
                                        {% for teacher in zhibo.teachers %}
                                        {{ web_macro.user_link(teacher, 'text-muted') }}
                                        {% endfor %}
                                </span>
                          </div>
                        {% set lessonUrl = path('course_learn', {id:zhibo.id}) ~ '#lesson/' ~ zhibo.lesson.id %}
             

             <div class="mask">
              <a href="{{ lessonUrl }}">
                  {% set teacher = zhibo.teachers|first %}
                  <div class="teacher-info clearfix">
                    <img class="img-circle pull-left" src="{{ file_path(teacher.smallAvatar, 'avatar.png') }}">
                    <span>{{ teacher.nickname }}</span>
                    <span>{{ teacher.title|plain_text(10) }}</span>
                  </div>
                  <p>{{ teacher.profile.about|plain_text(50) }}</p>
                  <span class="iconfont icon-jiantou"></span>
                  <h3 class="title">{{ zhibo.title|plain_text(8) }}</h3>
              </a>
            </div>

                    </div>
              </li>
            {% endif %}  
      {% endfor %}
      </ul>
    {% else %}
            <div class="empty">还没有直播课程</div>
    {% endif %}
    {% if data('RecentLiveCourses',{'count':count})|length >= 1 %}
           <a class="more" href="{{ path('live_course_explore') }}">更多&gt;</a>
    {% endif %}

</div>
